package com.kehao.newcoder;

import org.junit.Test;

import java.util.Stack;

public class NC76Solution {
    Stack<Integer> stack1 = new Stack<Integer>();
    Stack<Integer> stack2 = new Stack<Integer>();

    public void push(int node) {
        stack1.push(node);
    }

    public int pop() {
        if (stack2.isEmpty()) {
            while (!stack1.isEmpty()) {
                int pop = stack1.pop();
                stack2.push(pop);
            }
        }
        return stack2.pop();
    }

    @Test
    public void test(){
        NC76Solution solution = new NC76Solution();
        solution.push(1);
        solution.push(2);
        System.out.println(solution.pop());
        System.out.println(solution.pop());
    }

}
